package com.welyo.model.quizz {
	/**
	 * ...
	 * @author vu.doan
	 */
	public class TabItemVO {
		
		public static var TYPE_NUMBER	:String = "number";
		public static var TYPE_TEXT		:String = "text";
		
		private var type				:String;
		private var buttonLabel			:String;
		private var title				:String;
		private var description			:String;
		private var startTitle			:String;
		
		private var arrQuestion			:Array;
		private var hasComplete			:Boolean;
		
		public function TabItemVO(data:XML) {
			hasComplete = false;
			type = data.@type.toString();
			buttonLabel = data.buttonlabel.toString();
			title = data.title.toString();
			description = data.description.toString();
			startTitle = data.starttitle.toString();
			
			arrQuestion = [];
			
			var itm:BaseQuestionItemVO;
			for (var i:int = 0; i < data.questions.question.length(); i++) {
				if (type == TYPE_TEXT) {
					itm = new BaseQuestionItemVO(new XML(data.questions.question[i].toString()));
				} else if (type == TYPE_NUMBER) {
					itm = new NumberQuestionItemVO(new XML(data.questions.question[i].toString()));
				}
				
				arrQuestion.push(itm);
			}
		}
		
		public function get Type():String {
			return type;
		}
		
		public function get ButtonLabel():String {
			return buttonLabel;
		}
		
		public function get Title():String {
			return title;
		}
		
		public function get Description():String {
			return description;
		}
		
		public function get StartTitle():String {
			return startTitle;
		}
		
		public function get Questions():Array {
			return arrQuestion;
		}
		
		public function set HasComplete(value:Boolean):void {
			hasComplete = value;
		}
		
		public function get HasComplete():Boolean {
			return hasComplete;
		}
	}
}